package com.example.service.impl;

import com.example.mapper.MenuRoleMapper;
import com.example.service.IMenuRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: personnel-management
 * @description:
 * @author: ChenZhiXiang
 * @create: 2019-07-16 21:10
 **/
@Service
@Transactional
public class MenuRoleServiceImpl implements IMenuRoleService {

    @Autowired
    private MenuRoleMapper menuRoleMapper;

    @Override
    public int updateMenuRole(Long rid, Long[] mids) {
        menuRoleMapper.deleteMenuByRid(rid);
        if (mids.length == 0) {
            return 0;
        }
        return menuRoleMapper.addMenu(rid, mids);
    }
}
